package com.mobileapptracker;

import android.content.ContentProvider;
import android.content.ContentResolver;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Context;
import android.content.UriMatcher;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteQueryBuilder;
import android.net.Uri;
import android.util.Log;

public class MATProvider extends ContentProvider
{
  private static final String DATABASE_CREATE = "create table referrer_apps (_id integer primary key autoincrement, publisher_package_name text not null, tracking_id text, unique(publisher_package_name) on conflict replace);";
  private static final String DATABASE_NAME = "MAT";
  private static final String DATABASE_TABLE = "referrer_apps";
  private static final int DATABASE_VERSION = 1;
  public static final String PUBLISHER_PACKAGE_NAME = "publisher_package_name";
  private static final int REFERRER_APPS = 1;
  public static final String TRACKING_ID = "tracking_id";
  public static final String _ID = "_id";
  private static final UriMatcher uriMatcher = new UriMatcher(-1);
  private SQLiteDatabase matDB;

  static
  {
    uriMatcher.addURI("*", "referrer_apps", 1);
  }

  public int delete(Uri paramUri, String paramString, String[] paramArrayOfString)
  {
    switch (uriMatcher.match(paramUri))
    {
    default:
      throw new IllegalArgumentException("Unknown URI " + paramUri);
    case 1:
    }
    int i = this.matDB.delete("referrer_apps", paramString, paramArrayOfString);
    getContext().getContentResolver().notifyChange(paramUri, null);
    return i;
  }

  public String getType(Uri paramUri)
  {
    switch (uriMatcher.match(paramUri))
    {
    default:
      throw new IllegalArgumentException("Unsupported URI: " + paramUri);
    case 1:
    }
    return "vnd.android.cursor.dir/vnd.mobileapptracker.referrer_apps ";
  }

  public Uri insert(Uri paramUri, ContentValues paramContentValues)
  {
    long l = this.matDB.insert("referrer_apps", "", paramContentValues);
    if (l > 0L)
    {
      Uri localUri = ContentUris.withAppendedId(paramUri, l);
      getContext().getContentResolver().notifyChange(localUri, null);
      return localUri;
    }
    throw new SQLException("Failed to insert row into " + paramUri);
  }

  public boolean onCreate()
  {
    this.matDB = new DatabaseHelper(getContext()).getWritableDatabase();
    return this.matDB != null;
  }

  public Cursor query(Uri paramUri, String[] paramArrayOfString1, String paramString1, String[] paramArrayOfString2, String paramString2)
  {
    SQLiteQueryBuilder localSQLiteQueryBuilder = new SQLiteQueryBuilder();
    localSQLiteQueryBuilder.setTables("referrer_apps");
    if ((paramString2 == null) || (paramString2 == ""))
      paramString2 = "publisher_package_name";
    Cursor localCursor = localSQLiteQueryBuilder.query(this.matDB, paramArrayOfString1, paramString1, paramArrayOfString2, null, null, paramString2);
    localCursor.setNotificationUri(getContext().getContentResolver(), paramUri);
    return localCursor;
  }

  public int update(Uri paramUri, ContentValues paramContentValues, String paramString, String[] paramArrayOfString)
  {
    switch (uriMatcher.match(paramUri))
    {
    default:
      throw new IllegalArgumentException("Unknown URI " + paramUri);
    case 1:
    }
    int i = this.matDB.update("referrer_apps", paramContentValues, paramString, paramArrayOfString);
    getContext().getContentResolver().notifyChange(paramUri, null);
    return i;
  }

  private static class DatabaseHelper extends SQLiteOpenHelper
  {
    DatabaseHelper(Context paramContext)
    {
      super("MAT", null, 1);
    }

    public void onCreate(SQLiteDatabase paramSQLiteDatabase)
    {
      paramSQLiteDatabase.execSQL("create table referrer_apps (_id integer primary key autoincrement, publisher_package_name text not null, tracking_id text, unique(publisher_package_name) on conflict replace);");
    }

    public void onUpgrade(SQLiteDatabase paramSQLiteDatabase, int paramInt1, int paramInt2)
    {
      Log.w("Content provider database", "Upgrading database from version " + paramInt1 + " to " + paramInt2 + ", which will destroy all old data");
      paramSQLiteDatabase.execSQL("DROP TABLE IF EXISTS siteids");
      onCreate(paramSQLiteDatabase);
    }
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.mobileapptracker.MATProvider
 * JD-Core Version:    0.6.2
 */